package com.ruoyi.project.system.service.impl;

import com.ruoyi.project.system.domain.SysDepatment;
import com.ruoyi.project.system.mapper.SysDmMapper;
import com.ruoyi.project.system.service.ISysDmService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author :sxt
 * @dote :20:11 2021/7/13
 */
@Service
public class SysDmServiceImpl implements ISysDmService {
    @Autowired
    private SysDmMapper sysDmMapper;
    /**
     * 根据查询条件查询科室
     * @param sysDepatment
     * @return
     */
    @Override
    public List<SysDepatment> selectList(SysDepatment sysDepatment) {
        List<SysDepatment> list=sysDmMapper.selectList(sysDepatment);
        return list;
    }

    /**
     * 新增科室
     * @param sysDepatment
     * @return
     */
    @Override
    public int addDepatment(SysDepatment sysDepatment) {
        //设置下创建时间。
        sysDepatment.setCreateTime(new Date());
        return sysDmMapper.insert(sysDepatment);
    }

    /**
     * 根据ID查询科室
     * @param sdId
     * @return
     */
    @Override
    public SysDepatment getById(Integer sdId) {
        SysDepatment sysDepatment=sysDmMapper.selectById(sdId);
        return sysDepatment;
    }

    /**
     * 修改科室
     * @param sysDepatment
     * @return
     */
    @Override
    public int updateDepatment(SysDepatment sysDepatment) {
        //设置更新时间
        sysDepatment.setUpdateTime(new Date());
        return sysDmMapper.update(sysDepatment);
    }

    /**
     * 删除指定Id的科室
     * @param sdIds
     * @return
     */

    @Override
    public int removeDm(Integer[] sdIds) {

        return sysDmMapper.delete(sdIds) ;
    }

    /**
     * 查寻所有科室详细信息
     * @return
     */
    @Override
    public List<SysDepatment> getAllSdm() {
        return sysDmMapper.selectAllSdm();
    }


}
